let app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  wetchat:function(e){
    var index=e.currentTarget.dataset.index;
    var infoArr=this.data.msgList
    var t=infoArr[index]
    wx.redirectTo({
      url: "/business-service/pages/staff_customer/sendmsg?id=" + t.user_id + "&cus_id=" + t.cus_id + "&imgUrl=" + encodeURIComponent(t.user_avatar) + "&name=" + t.user_name + "&md5=" + t.md5 + "&from=" + t.source + "&user_openid=" + t.user_openid + "&is_intention=" + t.is_intention+"&phone=" + t.phone
    })
  },
  systemNews:function(){
    wx.navigateTo({
      url: '/business-service/pages/staff_news/systemNews/notice',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that=this
    wx.request({
      url: app.globalData.siteroot,
      data: {
        do:'System_noticecount',
        staff_id:wx.getStorageSync('staff_bind_id')
      },
      success: function(res) {
        that.setData({
          systemNews:res.data.info
        })
      }
    })
    wx.request({
      url: app.globalData.siteroot,
      data: {
        do:'Member_staffInfo',
        staff_id:wx.getStorageSync('staff_bind_id')
      },
      success: function(res) {
          var staff_chatid=res.data.info.chatid
          wx.request({
            url: app.globalData.siteroot,
            data: {
              do:'Buschat_msgList',
              staff_id:wx.getStorageSync('staff_bind_id'),
              target:2,
              chatid:staff_chatid
            },
            success: function(res) {
              that.setData({
                msgList:res.data.data
              })
            }
          })
      }
    })

    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})